<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>模糊核查</title>
        <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
        <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
        <script type="text/javascript" src="/webapp/js/common/config.js"></script>
    </head>
    <body>
        <div class="easyui-container-fluid">
            <div class="easyui-panel" style="border:none;">
                <div class="nav" id="nav"></div>
                <div class="easyui-panel" style="border:none;">
                    <form id="ff">
                        <div style="margin-bottom:20px;">
                     	<span>
                         <label class="item-label">年份：</label>
                         <input type="text" class="easyui-combobox" name="year" id="year" style="width:100px;"/>
                     	</span>
                            <span id="monthLabel">
	                         <label class="item-label">月份：</label>
	                         <input type="text" class="easyui-combobox" name="month" id="month" style="width:100px;"/></span>
                            <span id="weekLabel">
	                         <label class="item-label">周数：</label>
	                         <input type="text" class="easyui-combobox" name="week" id="week" style="width:100px;"/></span>
                            <label class="item-label">品类：</label>
                            <select id="categorySelect" name="categoryCode" class="easyui-combobox" style="width:100px;"></select>
                            <label class="item-label">标记：</label>
                            <select id="recordMark" name="recordMark" class="easyui-combobox" style="width:100px;">
                                <option value="auto" selected>auto</option>
                                <option value="alias" >alias</option>
                            </select>
                            <a href="javascript:void(0);" style="margin-left:40px;width:80px;" class="easyui-linkbutton c8" onclick="searchBy()">查询</a>
                        </div>
                        <div style="margin-bottom:20px;">
                            <div style="float: left;">
                                <label class="item-label" style="margin-top: 3px;">备注：</label>
                            </div>
                            <div style="float: left;margin-left: 10px;margin-bottom: 10px;">
                                <div>1. auto：模糊匹配,描述完全包含型号名。</div>
                                <div>2. alias：别名匹配,型号名包含Ai识别的型号，尾部允许有1/5的误差。</div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="table-wrapper">
                    <table id="datagrid" class="easyui-datagrid" data-options="fitColumns:true,scrollbarSize:0" style="max-height: 682px;">
                        <thead>
                            <tr>
                                <th data-options="field:'brandName',align:'center'" width="9%">品牌名</th>
                                <th data-options="field:'brandCode',align:'center'" width="9%">品牌码</th>
                                <th data-options="field:'modelName',align:'center'" width="10%">型号名</th>
                                <th data-options="field:'modelCode',align:'center'" width="9%">型号码</th>
                                <th data-options="field:'description',align:'center'" width="25%">描述</th>
                                <th data-options="field:'originalModel',align:'center'" width="25%">原始型号</th>
                                <th data-options="field:'modelAi',align:'center'" width="10">型号名(AI)</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </body>
    <script type="text/javascript">
        $(function(){
            setNav();
            //initChannelSelect("channelSelect");
            initUserCategorySelect("categorySelect");
            initMonthWeek("monthLabel","weekLabel");
            $("#datagrid").datagrid({
                // pagination:true,
                rownumbers:true
            });
            aRecords("模糊核查","/webapp/pages/product/audit/fuzzyCheck")
        });

        function searchBy(){
            var data = getFormData(document.getElementById("ff"));
            data.reportType=window.parent.workMode.toUpperCase();

            $.ajax({
                url:config.url + "/fuzzyCheck/getAll",
                type:"get",
                data:transfer(data),
                xhrFields:{withCredentials:true},
                beforeSend:function () {
                    $.messager.progress({
                        title:"请稍等",
                        interval:50,
                        text:"数据加载中..."
                    });
                },
                success:function(data){
                    $.messager.progress("close");
                    if (data.code == 200) {
                        if(data.msg && data.msg.length>0){
                            console.log(data.msg);
                            $("#datagrid").datagrid({data: data.msg}).datagrid("getPager");
                        }else{
                            $("#datagrid").datagrid({data: ["无记录"]}).datagrid("getPager");
                        }
                    }else {
                        $.messager.alert("提示", data.msg,"error");
                    }
                },
                error:function(data){
                    console.log(data);
                    $.messager.progress("close");
                }
            });
        }
    </script>
</html>